let aud = new Audio();

aud.transmit = function(url){
	console.log(this.vm)
	aud.src = url;
	aud.oncanplay = function(){
		console.log('playing');
		aud.play();
	}
}

// 监听音频播放的状态
aud.addEventListener("play",function(){
	// console.log("播放中");
	this.vm.$store.commit("changePlayerState","playing")
});
aud.addEventListener("pause",function(){
	// console.log("暂停")
	this.vm.$store.commit("changePlayerState","pause")
});
aud.addEventListener("timeupdate",function(){
	// console.log("持续播放中")
	let currentTime = aud.currentTime;
	let currentDuration = aud.duration;
	// console.log(currentTime)
	this.vm.$store.commit("getCurrentTime",{
		curTime:currentTime,
		curDuration:currentDuration
	})
})

export default aud;